echo ======开始写入=======

function success(){
    echo "         __     "
    echo "  ____  |  | __ "
    echo " /  _ \ |  |/ / "
    echo "(  <_> )|    <  "
    echo " \____/ |__|_ \ "
    echo "             \/ "
}
function fail(){
    echo "  _____         .__ .__   "
    echo "_/ ____\_____   |__||  |  "
    echo "\   __\ \__  \  |  ||  |  "
    echo " |  |    / __ \_|  ||  |__"
    echo " |__|   (____  /|__||____/"
    echo "             \/           "
}
STLinkCli='D:\Program Files\STM32App\STM32 ST-LINK Utility\ST-LINK Utility\ST-LINK_CLI.exe'

"${STLinkCli}" -P $1 0x08000000 -V "after_programming"

if [ $? -eq 0 ];then
    "${STLinkCli}" -RST
    success
else
    fail
fi